package com.example.sixtrainingdemo.presenter;

import android.content.ContentUris;
import android.content.ContentValues;
import android.content.Context;
import android.net.Uri;
import android.util.Log;

import com.example.sixtrainingdemo.contract.AddRoundContract;
import com.example.sixtrainingdemo.contract.AddTalkContract;
import com.example.sixtrainingdemo.entity.Round;
import com.example.sixtrainingdemo.entity.RoundPhoto;
import com.example.sixtrainingdemo.entity.Talk;

import java.util.List;

public class AddTalkPresenter implements AddTalkContract.IAddTalkPresenter {

   private AddTalkContract.IAddTalkView mAddTalkView;
   private Context mContext;

   public AddTalkPresenter(AddTalkContract.IAddTalkView addTalkView, Context context) {
      mAddTalkView = addTalkView;
      mContext = context;
   }

   @Override
   public void saveTalk(Talk talk) {
      new Thread(new Runnable() {
         @Override
         public void run() {
            //商品插入
            ContentValues cv = new ContentValues();
            cv.put("talk_message", talk.getMessage());
            Uri goodsUrl = Uri.parse("content://com.example.sixtrainingdemo.provider/talk");
            Uri insertUri = mContext.getContentResolver().insert(goodsUrl, cv);
            long newRowId = ContentUris.parseId(insertUri);
            Log.d("", "新插入的商品id ===== " + newRowId);

         }
      }).start();
   }
}
